/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package ru.jSkyRoom.factory;

import java.util.Collection;
import ru.jSkyRoom.interfaces.major.Armor;
import ru.jSkyRoom.interfaces.major.Enchantment;
import ru.jSkyRoom.interfaces.JSkyMod;
import ru.jSkyRoom.interfaces.major.Keyword;
import ru.jSkyRoom.selector.AbstractFromModByEdidSelector;
import ru.jSkyRoom.selector.SelectorByEdid;
import ru.jSkyRoom.selector.SelectorFacade;

/**
 *
 * @author Rakev
 */
public abstract class SelectorByEdidFactory {

    private static SelectorByEdidFactory instance = new SelectorByEdidFactory() {
        @Override
        protected SelectorFacade getSelectorFacade() {
            return SelectorFacade.create();
        }
    };

    public static SelectorByEdidFactory create() {
        return instance;
    }

    public static SelectorByEdidFactory create(final JSkyMod mod) {
        return new SelectorByEdidFactory() {
            @Override
            protected SelectorFacade getSelectorFacade() {
                return SelectorFacade.create(mod);
            }
        };
    }

    protected abstract SelectorFacade getSelectorFacade();

    public SelectorByEdid<Keyword> createKeywordSelector() {
        return new AbstractFromModByEdidSelector<Keyword>() {
            @Override
            protected Collection<Keyword> getExistMajors() {
                return getSelectorFacade().selectKeywords();
            }
        };
    }

    public SelectorByEdid<Armor> createArmorSelector() {
        return new AbstractFromModByEdidSelector<Armor>() {
            @Override
            protected Collection<Armor> getExistMajors() {
                return getSelectorFacade().selectArmors();
            }
        };
    }

    public SelectorByEdid<Enchantment> createEnchantmentSelector() {
        return new AbstractFromModByEdidSelector<Enchantment>() {
            @Override
            protected Collection<Enchantment> getExistMajors() {
                return getSelectorFacade().selectEnchantments();
            }
        };
    }
}
